package org.example.Server.controller.user;

import lombok.extern.slf4j.Slf4j;
import org.example.Server.model.user.UserDTO;
import org.example.Server.model.user.UserInfo;
import org.example.Server.service.user.UserService;
import org.example.Server.utils.ResultAPI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/youxich/user")
public class UserController {
    @Autowired
    UserService userService;

    /**
     * 更新个人信息
     * @param user
     * @return
     */
    @PostMapping()
    public ResultAPI updateUser(@RequestBody UserInfo user) {
        return userService.updateUser(user);
    }

    /**
     * 获取个人信息
     * @param userId
     * @return
     */
    @GetMapping()
    public ResultAPI getUser(@RequestParam Integer userId) {
        return userService.getUser(userId);
    }
}
